/* MERARY cookie consent — compact bottom strip */
.merary-cookie {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 9000;
  display: none;
  pointer-events: none;
  padding: 0 0 env(safe-area-inset-bottom, 0);
}

.merary-cookie.is-visible {
  display: block;
  pointer-events: auto;
  animation: meraryCookieIn 0.32s ease both;
}

@keyframes meraryCookieIn {
  from {
    opacity: 0;
    transform: translateY(100%);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.merary-cookie__panel {
  max-width: none;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px clamp(12px, 2vw, 20px);
  padding-right: clamp(200px, 24vw, 320px);
  border-radius: 0;
  border: 0;
  border-top: 1px solid rgba(240, 79, 119, 0.12);
  background: rgba(255, 250, 251, 0.62);
  box-shadow: 0 -4px 18px rgba(73, 32, 43, 0.04);
  backdrop-filter: blur(16px) saturate(1.1);
  -webkit-backdrop-filter: blur(16px) saturate(1.1);
}

.merary-cookie__mark {
  flex: 0 0 auto;
  width: 32px;
  height: 32px;
  border-radius: 10px;
  background: rgba(255, 241, 245, 0.5);
  display: grid;
  place-items: center;
  color: #f04f77;
  font-size: 16px;
}

.merary-cookie__text {
  flex: 1 1 auto;
  min-width: 0;
  font-family: Manrope, system-ui, sans-serif;
  font-size: 12px;
  line-height: 1.35;
  color: rgba(74, 65, 68, 0.92);
}

.merary-cookie__lead,
.merary-cookie__policy {
  display: none;
}

.merary-cookie__text a {
  color: #f04f77;
  font-weight: 600;
  text-decoration: none;
  border-bottom: 1px solid rgba(240, 79, 119, 0.3);
}

.merary-cookie__text a:hover {
  border-bottom-color: #f04f77;
}

.merary-cookie__actions {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 8px;
}

.merary-cookie__btn {
  appearance: none;
  border: 0;
  cursor: pointer;
  font-family: Manrope, system-ui, sans-serif;
  font-size: 12px;
  font-weight: 700;
  border-radius: 999px;
  padding: 8px 14px;
  transition: transform 0.15s ease, filter 0.15s ease, background 0.15s ease;
}

.merary-cookie__btn--accept {
  background: rgba(240, 79, 119, 0.9);
  color: #fff;
  box-shadow: 0 4px 12px rgba(240, 79, 119, 0.16);
}

.merary-cookie__btn--accept:hover {
  filter: brightness(1.03);
  transform: translateY(-1px);
}

.merary-cookie__btn--more {
  background: transparent;
  color: #7a6a6e;
  border: 1px solid #efdee3;
  padding: 7px 12px;
  font-weight: 600;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
}

.merary-cookie__btn--more:hover {
  background: rgba(255, 247, 249, 0.7);
  color: #f04f77;
  border-color: #ffc5d3;
}

/* Модалка поверх куки — не перекрываем карточку промо */
html:has(.site-modal-overlay.is-visible) .merary-cookie.is-visible {
  z-index: 8000;
  pointer-events: none;
}

html:has(.site-modal-overlay.is-visible) .merary-cookie.is-visible .merary-cookie__panel {
  opacity: 0.55;
}

@media (max-width: 47.9375rem) {
  html:has(.merary-cookie.is-visible) .hero-merary__features {
    padding-bottom: calc(7.5rem + env(safe-area-inset-bottom, 0px));
  }
}

@media (max-width: 53.125rem) {
  .merary-cookie {
    left: 0;
    right: 0;
    width: 100%;
    bottom: 0;
    background: transparent;
  }

  .merary-cookie__panel {
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    height: 68px;
    max-height: 68px;
    padding: 0 16px;
    box-sizing: border-box;
    background: rgba(255, 245, 248, 0.62);
    border-top: 1px solid rgba(240, 79, 119, 0.12);
    box-shadow: 0 -8px 20px rgba(70, 30, 40, 0.08);
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
  }

  .merary-cookie__mark,
  .merary-cookie__extra,
  .merary-cookie__btn--more {
    display: none;
  }

  .merary-cookie__text {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 0;
    min-width: 0;
    color: #4a4144;
    font-size: 12px;
    font-weight: 400;
    line-height: 1.2;
    letter-spacing: 0;
  }

  .merary-cookie__lead {
    display: block;
    font-weight: 400;
    font-size: 12px;
    line-height: 1.2;
    letter-spacing: 0;
    color: #4a4144;
  }

  .merary-cookie__text a.merary-cookie__policy {
    display: inline;
    align-self: flex-start;
    margin-top: 3px;
    font-size: 12px;
    font-weight: 400;
    line-height: 1.2;
    letter-spacing: 0;
    color: #f04f77;
  }

  .merary-cookie__actions {
    width: auto;
    margin-left: auto;
  }

  .merary-cookie__btn--accept {
    flex: none;
    width: auto;
    height: 40px;
    min-height: 40px;
    padding: 0 18px;
    border-radius: 999px;
    white-space: nowrap;
    text-align: center;
  }
}

/* Баннер живёт в #site-viewport-overlays (вне <body>), поэтому привязка к html.
   Поднимаем его над нижней навигацией; --merary-bottom-nav-h выставляет cookie-consent.js. */
@media (max-width: 53.125rem) {
  html:has(.site-bottom-nav) .merary-cookie {
    bottom: var(--merary-bottom-nav-h, calc(var(--site-bottom-nav-offset, 3.625rem) + env(safe-area-inset-bottom, 0px)));
    z-index: 9400;
    padding-bottom: 0;
  }

  /* Контент страницы не должен прятаться под баннером, пока он открыт. */
  html:has(.merary-cookie.is-visible):has(.site-bottom-nav) body:not(.premium-page) {
    padding-bottom: calc(var(--merary-bottom-nav-h, calc(var(--site-bottom-nav-offset, 3.625rem) + env(safe-area-inset-bottom, 0px))) + var(--merary-cookie-h, 68px));
  }
}
